const appKey = "26edf81b1856232b"

let ccbRequest = {
	getP8Request(rawJson) {
		let newJson = {
			"app-key": appKey,
			"reqData": {
				"Head": {
					"SYS_TX_CODE": "A1161T111",
					"SYS_TX_SCEN": "A1161T111_1",
					"newFormat": "1",
					"COM1": {
						"TXN_INSID": "999999999",
						"TXN_ITT_CHNL_ID": "001",
						"TXN_ITT_CHNL_CGY_CODE": "99999999",
						"TXN_STFF_ID": "88888888"
					},
					"COM2": {
						"PID": "G0000000004"
					},
					"COM4": {
						"PAGE_JUMP": "1",
						"REC_IN_PAGE": "20"
					}
				},
				"Data": {}
			}
		}
		//报文头
		if (rawJson.hasOwnProperty("SYS_TX_CODE")) newJson.reqData.Head['SYS_TX_CODE'] = rawJson['SYS_TX_CODE']
		if (rawJson.hasOwnProperty("SYS_TX_SCEN")) newJson.reqData.Head['SYS_TX_SCEN'] = rawJson['SYS_TX_SCEN']
		if (rawJson.hasOwnProperty("TXN_INSID")) newJson.reqData.Head.COM1['TXN_INSID'] = rawJson['TXN_INSID']
		if (rawJson.hasOwnProperty("TXN_ITT_CHNL_ID")) newJson.reqData.Head.COM1['TXN_ITT_CHNL_ID'] = rawJson[
			'TXN_ITT_CHNL_ID']
		if (rawJson.hasOwnProperty("TXN_ITT_CHNL_CGY_CODE")) newJson.reqData.Head.COM1['TXN_ITT_CHNL_CGY_CODE'] = rawJson[
			'TXN_ITT_CHNL_CGY_CODE']
		if (rawJson.hasOwnProperty("TXN_STFF_ID")) newJson.reqData.Head.COM1['TXN_STFF_ID'] = rawJson['TXN_STFF_ID']
		if (rawJson.hasOwnProperty("PID")) newJson.reqData.Head.COM2['PID'] = rawJson['PID']
		if (rawJson.hasOwnProperty("PAGE_JUMP")) newJson.reqData.Head.COM4['PAGE_JUMP'] = rawJson['PAGE_JUMP']
		if (rawJson.hasOwnProperty("REC_IN_PAGE")) newJson.reqData.Head.COM4['REC_IN_PAGE'] = rawJson['REC_IN_PAGE']
		//报文体
		newJson.reqData.Data = rawJson['Data']
		return newJson
	}
}

export default ccbRequest
